function get_crossval(X_total,d)
[fi, tex] = fopen('resultados_palito_crossval.csv', 'a');


cantidadCaracteristicas = [2 4 8 10 20 30];
fprintf(fi, '\nCaracteristicas, KNN30,,, KNN10,,, LDA,,, Dminimal,,\n');
for i=1:length(cantidadCaracteristicas)
    
    final =cantidadCaracteristicas(i);
    
    X = squeeze(X_total(i,:,1:final));
    for j=1:500;
        [TT per(:,j)] = crossval(X,d,10,'knn',30);
    end;
    A =Confianza(per);
    fprintf(fi, '\n%d, %f ,%f ,%f,', final,mean(per(:)) , A(1), A(2));
    for j=1:500;
        [TT per(:,j)] = crossval(X,d,10,'knn',10);
    end;
    A =Confianza(per);
    fprintf(fi, '%f ,%f ,%f,',mean(per(:)), A(1), A(2));
    for j=1:500;
        [TT per(:,j)] = crossval(X,d,10,'lda');
    end;
    A =Confianza(per);
    fprintf(fi, '%f ,%f ,%f,',mean(per(:)) , A(1), A(2));
    for j=1:500;
        [TT per(:,j)] = crossval(X,d,10,'dminimal');
    end;
    A =Confianza(per);
    fprintf(fi, '%f ,%f ,%f,',mean(per(:)) , A(1), A(2));
    
end
st = fclose(fi);
end
function confidence = Confianza(per)
per_s = sort(per);
idx = round(length(per))*(1-.95/2);
con = per_s(idx:end-idx);
confidence = [con(1);con(end)];
end